const Koa = require('koa');
const path = require('path');
const stat = require('koa-static');

const loadModules = require('./src/server/load-modules');
const loadRouters = require('./src/server/load-routers');

const app = new Koa();
app.use(stat(path.join(__dirname, 'public')));
app.use(stat(path.join(__dirname, 'apkrelease')));

loadModules(app);
loadRouters(app);

app.listen(8869, '0.0.0.0', async () => {
    console.info('node listening 8869!');
});

module.exports = app;
